#include "GameDirector.h"

#include <stdio.h>

extern SDL_Window* pWindow;
extern SDL_Renderer* pRenderer;


GameDirector::GameDirector() {
}


GameDirector::~GameDirector() {
}

void GameDirector::InitGame() {
	bool jmpoutflag = true;
	int result;
	result = SDL_Init(SDL_INIT_EVERYTHING);
	if (result == -1) {
		printf("Fatal Error: SDL_Init Failed\n");
		return;
	}
	pWindow = SDL_CreateWindow("Don't Tap The White Tile", 10, 10, 400, 600, SDL_WINDOW_OPENGL);
	pRenderer = SDL_CreateRenderer(pWindow, -1, SDL_RENDERER_SOFTWARE);
	SDL_RenderClear(pRenderer);
	// init deivce...

	// this is just welcome loading loops
	SDL_Event event;
	Uint32 tbefore = SDL_GetTicks();
	while (jmpoutflag) {
		while (SDL_PollEvent(&event)) {
			switch (event.type)
			{
			case SDL_QUIT:
				GameQuit();
				break;
			
			default:
				break;
			}
		}
		if ((SDL_GetTicks() - tbefore) > 33) {
			
			tbefore = SDL_GetTicks();
		}
	}
	
}

void GameDirector::InitGameWorld(GameWorld* gameworld){
	
}

void GameDirector::LoadResources() {
	
}

void GameDirector::ReleaseResources() {

}

void GameDirector::GameQuit() {
	SDL_Quit();
	exit(0);
}